package scau.gsmg.misp.dao;

import java.sql.Timestamp;
import java.util.List;

import scau.gsmg.misp.vo.Payment;
import scau.gsmg.misp.vo.SaleOrder;
import scau.gsmg.misp.vo.SaleReturn;
import scau.gsmg.misp.vo.User;

/**
 * @Title 退货
 * @Group gaoshenmegui
 * @author ZCL
 * @date 2015年5月9日
 */
public interface IReturnGoodsDAO {
	/**
	 * @Description 通过支付单号得到销售单号
	 */
	public String gainSaleOrderId(String paymentId) throws Exception;
	public int gainSaleId(String paymentId) throws Exception;
	/**
	 * @Description 获取单据中的商品
	 */
	public List gainGoods(String saleOrderId) throws Exception;
	/**
	 * @Description 得到销售单信息
	 */
	public List gainSaleOrder(String paymentId) throws Exception;
	/**
	 * @Description 获取退货表最新一条记录
	 */
	public String lastReturnRecord() throws Exception;
	/**
	 * @Description	生成退货记录
	 */
	public SaleReturn createSaleReturn(String returnId,SaleOrder saleOrder,double total,int amount,User user,Timestamp time) throws Exception;
	/**
	 * @Description 在退货商品表生成记录
	 */
	public boolean writeReturnGoods(String rowObj, SaleReturn saleReturn,String saleOrderId) throws Exception;
	/**
	 * @Description 得到销售单对象
	 */
	public SaleOrder gainSaleOrderObj(String saleOrderId) throws Exception;
	/**
	 * @Description 通过用户ID返回用户对象
	 */
	public User gainUser(int userId) throws Exception;
	/**
	 * @Description 退货后，更新销售商品表
	 */
	public boolean updateSaleOrderItems(String rowObj,int saleOrderId) throws Exception;
	/**
	 * @Description 修改原支付单信息（更新找款）
	 */
	public boolean updatePayment(double totalReturn,int saleOrderId) throws Exception;
	/**
	 * @Description 修改原销售单信息（更新总数量，总金额，应收款）
	 */
	public boolean updateSaleOrder(int amount,double totalPrice,double totalReturn,int saleId) throws Exception;
	/**
	 * @Description 更新会员积分
	 */
	public boolean updateIntegral(int customerId,int integral) throws Exception;
}
